home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / emacs.lha / emacs-19.16 / src / filelock.cpp.c < prev    next >
C/C++ Source or Header  |  1993-06-20  |  27KB  |  2,977 lines

  1. # 1 "filelock.c"
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21. # 1 "/usr/local/lib/gcc-lib/m68k-hp-bsd/2.4.3/include/sys/types.h" 1 3
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. typedef    unsigned char    u_char;
  47. typedef    unsigned short    u_short;
  48. typedef    unsigned int    u_int;
  49. typedef    unsigned long    u_long;
  50. typedef    unsigned short    ushort;         
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62. typedef    struct    _physadr { int r[1]; } *physadr;
  63. typedef    struct    label_t    {
  64.     int    val[15];         
  65. } label_t;
  66.  
  67. typedef    struct    _quad { long val[2]; } quad;
  68. typedef    long    daddr_t;
  69. typedef    char *    caddr_t;
  70. typedef    u_long    ino_t;
  71. typedef    long    swblk_t;
  72.  
  73.  
  74. typedef unsigned long int size_t;
  75.  
  76. typedef    long    time_t;
  77. typedef    short    dev_t;
  78. typedef    long    off_t;
  79. typedef    u_short    uid_t;
  80. typedef    u_short    gid_t;
  81. typedef    u_long    fixpt_t;
  82. typedef    long    key_t;
  83. typedef    long    paddr_t;     
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96. typedef long    fd_mask;
  97.  
  98.  
  99.  
  100.  
  101.  
  102. typedef    struct fd_set {
  103.     fd_mask    fds_bits[((( 256  )+((  (sizeof(fd_mask) * 8        )     )-1))/(  (sizeof(fd_mask) * 8        )     )) ];
  104. } fd_set;
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. # 20 "filelock.c" 2
  119.  
  120. # 1 "/usr/include/sys/stat.h" 1 3
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130. struct    stat
  131. {
  132.     dev_t    st_dev;
  133.     ino_t    st_ino;
  134.     unsigned short st_mode;
  135.     short    st_nlink;
  136.     uid_t    st_uid;
  137.     gid_t    st_gid;
  138.     dev_t    st_rdev;
  139.     off_t    st_size;
  140.     time_t    st_atime;
  141.     int    st_spare1;
  142.     time_t    st_mtime;
  143.     int    st_spare2;
  144.     time_t    st_ctime;
  145.     int    st_spare3;
  146.     long    st_blksize;
  147.     long    st_blocks;
  148.     long    st_spare4[2];
  149. };
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165. # 21 "filelock.c" 2
  166.  
  167. # 1 "config.h" 1
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.   
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289. # 1 "s/bsd4-3.h" 1
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425. # 122 "config.h" 2
  426.  
  427.  
  428.  
  429.  
  430.  
  431.  
  432.  
  433.  
  434.  
  435.  
  436.  
  437. # 1 "m/hp9000s300.h" 1
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473. # 49 "m/hp9000s300.h"
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572.  
  573. # 232 "m/hp9000s300.h"
  574.  
  575. # 133 "config.h" 2
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637. # 205 "config.h"
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647. extern char *getenv ();
  648.  
  649.  
  650.  
  651. # 22 "filelock.c" 2
  652.  
  653.  
  654.  
  655.  
  656.  
  657. # 1 "/usr/include/pwd.h" 1 3
  658.  
  659.  
  660. struct    passwd {  
  661.     char    *pw_name;
  662.     char    *pw_passwd;
  663.     int    pw_uid;
  664.     int    pw_gid;
  665.     int    pw_quota;
  666.     char    *pw_comment;
  667.     char    *pw_gecos;
  668.     char    *pw_dir;
  669.     char    *pw_shell;
  670. };
  671.  
  672. struct passwd *getpwent(), *getpwuid(), *getpwnam();
  673. # 27 "filelock.c" 2
  674.  
  675.  
  676.  
  677. # 1 "/usr/include/errno.h" 1 3
  678.  
  679.  
  680.  
  681.  
  682.  
  683. # 1 "/usr/include/sys/errno.h" 1 3
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.      
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.      
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.      
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795. # 6 "/usr/include/errno.h" 2 3
  796.  
  797.  
  798. extern int errno;
  799. # 30 "filelock.c" 2
  800.  
  801. # 1 "/usr/local/lib/gcc-lib/m68k-hp-bsd/2.4.3/include/sys/file.h" 1 3
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812. # 38 "/usr/local/lib/gcc-lib/m68k-hp-bsd/2.4.3/include/sys/file.h" 3
  813.  
  814. # 1 "/usr/local/lib/gcc-lib/m68k-hp-bsd/2.4.3/include/sys/fcntl.h" 1 3
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882. struct flock {
  883.         short   l_type;         
  884.         short   l_whence;     
  885.         long    l_start;     
  886.         long    l_len;           
  887.         short   l_pid;         
  888.         short   l_xxx;         
  889. };
  890.  
  891.  
  892. # 39 "/usr/local/lib/gcc-lib/m68k-hp-bsd/2.4.3/include/sys/file.h" 2 3
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938. # 93 "/usr/local/lib/gcc-lib/m68k-hp-bsd/2.4.3/include/sys/file.h" 3
  939.  
  940. # 31 "filelock.c" 2
  941.  
  942.  
  943.  
  944.  
  945.  
  946. # 1 "lisp.h" 1
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971. enum Lisp_Type
  972.   {
  973.      
  974.     Lisp_Int,
  975.  
  976.      
  977.     Lisp_Symbol,
  978.  
  979.      
  980.     Lisp_Marker,
  981.  
  982.      
  983.  
  984.     Lisp_String,
  985.  
  986.      
  987.  
  988.     Lisp_Vector,
  989.  
  990.      
  991.     Lisp_Cons,
  992.  
  993.      
  994.  
  995.  
  996.     Lisp_Compiled,
  997.  
  998.      
  999.     Lisp_Buffer,
  1000.  
  1001.      
  1002.  
  1003.  
  1004.     Lisp_Subr,
  1005.  
  1006.      
  1007.  
  1008.  
  1009.     Lisp_Internal,
  1010.  
  1011.      
  1012.  
  1013.  
  1014.  
  1015.  
  1016.     Lisp_Intfwd,
  1017.  
  1018.      
  1019.  
  1020.  
  1021.  
  1022.     Lisp_Boolfwd,
  1023.  
  1024.      
  1025.  
  1026.     Lisp_Process,
  1027.  
  1028.      
  1029.  
  1030.  
  1031.  
  1032.  
  1033.     Lisp_Objfwd,
  1034.  
  1035.  
  1036.      
  1037.  
  1038.  
  1039.  
  1040.     Lisp_Frame,
  1041.  
  1042.  
  1043.      
  1044.  
  1045.  
  1046.  
  1047.     Lisp_Internal_Stream,
  1048.  
  1049.      
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.     Lisp_Buffer_Local_Value,
  1081.  
  1082.      
  1083.  
  1084.  
  1085.  
  1086.     Lisp_Some_Buffer_Local_Value,
  1087.  
  1088.  
  1089.      
  1090.  
  1091.     Lisp_Buffer_Objfwd,
  1092.  
  1093.      
  1094.  
  1095.     Lisp_Void,
  1096.  
  1097.      
  1098.  
  1099.     Lisp_Window,
  1100.  
  1101.      
  1102.     Lisp_Window_Configuration,
  1103.  
  1104.  
  1105.     Lisp_Float,
  1106.  
  1107.  
  1108.      
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.     Lisp_Overlay
  1115.   };
  1116.  
  1117. # 237 "lisp.h"
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.  
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252. # 408 "lisp.h"
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287. struct interval
  1288. {
  1289.    
  1290.  
  1291.   unsigned int total_length;     
  1292.   unsigned int position;     
  1293.   struct interval *left;     
  1294.   struct interval *right;     
  1295.   struct interval *parent;     
  1296.  
  1297.  
  1298.    
  1299.  
  1300.  
  1301.  
  1302.   unsigned char write_protect;         
  1303.   unsigned char visible;         
  1304.   unsigned char front_sticky;         
  1305.  
  1306.   unsigned char rear_sticky;         
  1307.  
  1308.   int  plist;             
  1309. };
  1310.  
  1311. typedef struct interval *INTERVAL;
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326. # 491 "lisp.h"
  1327.  
  1328.  
  1329.  
  1330.  
  1331. struct Lisp_Cons
  1332.   {
  1333.     int  car, cdr;
  1334.   };
  1335.  
  1336.  
  1337.  
  1338.  
  1339. struct Lisp_Buffer_Cons
  1340.   {
  1341.     int  car, cdr;
  1342.     struct buffer *buffer;
  1343.     int bufpos;
  1344.   };
  1345.  
  1346.  
  1347.  
  1348. struct Lisp_String
  1349.   {
  1350.     int size;
  1351.     INTERVAL intervals;          
  1352.     unsigned char data[1];
  1353.   };
  1354.  
  1355. struct Lisp_Vector
  1356.   {
  1357.     int size;
  1358.     struct Lisp_Vector *next;
  1359.     int  contents[1];
  1360.   };
  1361.  
  1362.  
  1363.  
  1364. struct Lisp_Symbol
  1365.   {
  1366.     struct Lisp_String *name;
  1367.     int  value;
  1368.     int  function;
  1369.     int  plist;
  1370.     struct Lisp_Symbol *next;     
  1371.   };
  1372.  
  1373. struct Lisp_Subr
  1374.   {
  1375.     int  (*function) ();
  1376.     short min_args, max_args;
  1377.     char *symbol_name;
  1378.     char *prompt;
  1379.     char *doc;
  1380.   };
  1381.  
  1382.  
  1383.  
  1384. struct Lisp_Marker
  1385.   {
  1386.     struct buffer *buffer;
  1387.     int  chain;
  1388.     int bufpos;
  1389.     int modified;
  1390.   };
  1391.  
  1392.  
  1393.  
  1394. struct Lisp_Float
  1395.   {
  1396.     int  type;         
  1397.  
  1398.     double data;  
  1399.   };
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406. typedef unsigned char UCHAR;
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625. extern void defsubr ();
  1626.  
  1627.  
  1628.  
  1629.  
  1630. extern void defvar_lisp ();
  1631. extern void defvar_bool ();
  1632. extern void defvar_int ();
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658. struct specbinding
  1659.   {
  1660.     int  symbol, old_value;
  1661.     int  (*func) ();
  1662.     int  unused;         
  1663.   };
  1664.  
  1665. extern struct specbinding *specpdl;
  1666. extern struct specbinding *specpdl_ptr;
  1667. extern int specpdl_size;
  1668.  
  1669.  
  1670. struct handler
  1671.   {
  1672.      
  1673.     int  handler;
  1674.     int  var;
  1675.  
  1676.      
  1677.     struct catchtag *tag;
  1678.  
  1679.      
  1680.     struct handler *next;
  1681.   };
  1682.  
  1683. extern struct handler *handlerlist;
  1684.  
  1685. extern struct catchtag *catchlist;
  1686. extern struct backtrace *backtrace_list;
  1687.  
  1688.  
  1689.  
  1690. extern char *stack_bottom;
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739. extern int  Vascii_downcase_table, Vascii_upcase_table;
  1740.  
  1741.  
  1742.  
  1743. extern int consing_since_gc;
  1744.  
  1745.  
  1746.  
  1747. extern int gc_cons_threshold;
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761. extern struct gcpro *gcprolist;
  1762.  
  1763. struct gcpro
  1764.   {
  1765.     struct gcpro *next;
  1766.     int  *var;         
  1767.     int nvars;             
  1768.   };
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.  
  1790.  
  1791.  
  1792.  
  1793.  
  1794. void staticpro();
  1795.   
  1796.  
  1797.  
  1798.  
  1799.  
  1800.  
  1801.  
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811. extern int  Qnil, Qt, Qquote, Qlambda, Qsubr, Qunbound;
  1812. extern int  Qerror_conditions, Qerror_message, Qtop_level;
  1813. extern int  Qerror, Qquit, Qwrong_type_argument, Qargs_out_of_range;
  1814. extern int  Qvoid_variable, Qvoid_function;
  1815. extern int  Qsetting_constant, Qinvalid_read_syntax;
  1816. extern int  Qinvalid_function, Qwrong_number_of_arguments, Qno_catch;
  1817. extern int  Qend_of_file, Qarith_error;
  1818. extern int  Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
  1819.  
  1820. extern int  Qrange_error, Qdomain_error, Qsingularity_error;
  1821. extern int  Qoverflow_error, Qunderflow_error;
  1822.  
  1823. extern int  Qintegerp, Qnumberp, Qnatnump, Qsymbolp, Qlistp, Qconsp;
  1824. extern int  Qstringp, Qarrayp, Qsequencep, Qbufferp;
  1825. extern int  Qchar_or_string_p, Qmarkerp, Qvectorp;
  1826. extern int  Qinteger_or_marker_p, Qnumber_or_marker_p;
  1827. extern int  Qboundp, Qfboundp;
  1828. extern int  Qbuffer_or_string_p;
  1829. extern int  Qcdr;
  1830.  
  1831.  
  1832. extern int  Qfloatp, Qinteger_or_floatp, Qinteger_or_float_or_marker_p;
  1833.  
  1834.  
  1835. extern int  Qframep;
  1836.  
  1837. extern int  Feq (), Fnull (), Flistp (), Fconsp (), Fatom (), Fnlistp ();
  1838. extern int  Fintegerp (), Fnatnump (), Fsymbolp ();
  1839. extern int  Fvectorp (), Fstringp (), Farrayp (), Fsequencep ();
  1840. extern int  Fbufferp (), Fmarkerp (), Fsubrp (), Fchar_or_string_p ();
  1841. extern int  Finteger_or_marker_p ();
  1842.  
  1843. extern int  Ffloatp(), Finteger_or_floatp();
  1844. extern int  Finteger_or_float_or_marker_p(), Ftruncate();
  1845.  
  1846.  
  1847. extern int  Fcar (), Fcar_safe(), Fcdr (), Fcdr_safe();
  1848. extern int  Fsetcar (), Fsetcdr ();
  1849. extern int  Fboundp (), Ffboundp (), Fmakunbound (), Ffmakunbound ();
  1850. extern int  Fsymbol_function (), Fsymbol_plist (), Fsymbol_name ();
  1851. extern int  indirect_function (), Findirect_function ();
  1852. extern int  Ffset (), Fsetplist ();
  1853. extern int  Fsymbol_value (), find_symbol_value (), Fset ();
  1854. extern int  Fdefault_value (), Fset_default (), Fdefault_boundp ();
  1855.  
  1856. extern int  Faref (), Faset (), Farray_length ();
  1857.  
  1858. extern int  Fstring_to_number (), Fnumber_to_string ();
  1859. extern int  Feqlsign (), Fgtr (), Flss (), Fgeq (), Fleq ();
  1860. extern int  Fneq (), Fzerop ();
  1861. extern int  Fplus (), Fminus (), Ftimes (), Fquo (), Frem ();
  1862. extern int  Fmax (), Fmin ();
  1863. extern int  Flogand (), Flogior (), Flogxor (), Flognot ();
  1864. extern int  Flsh (), Fash ();
  1865.  
  1866. extern int  Fadd1 (), Fsub1 ();
  1867.  
  1868. extern int  make_number ();
  1869. extern int    long_to_cons ();
  1870. extern unsigned long cons_to_long ();
  1871. extern void args_out_of_range ();
  1872. extern void args_out_of_range_3 ();
  1873. extern int  wrong_type_argument ();
  1874.  
  1875. extern int  Ffloat_to_int(), Fint_to_float();
  1876. extern double extract_float();
  1877. extern int  make_float ();
  1878. extern int  Ffloat ();
  1879.  
  1880.  
  1881.  
  1882. extern int  Qstring_lessp;
  1883. extern int  Vfeatures;
  1884. extern int  Fidentity (), Frandom ();
  1885. extern int  Flength ();
  1886. extern int  Fappend (), Fconcat (), Fvconcat (), Fcopy_sequence ();
  1887. extern int  Fsubstring ();
  1888. extern int  Fnth (), Fnthcdr (), Fmemq (), Fassq (), Fassoc ();
  1889. extern int  Frassq (), Fdelq (), Fsort ();
  1890. extern int  Freverse (), Fnreverse (), Fget (), Fput (), Fequal ();
  1891. extern int  Ffillarray (), Fnconc (), Fmapcar (), Fmapconcat ();
  1892. extern int  Fy_or_n_p (), do_yes_or_no_p ();
  1893. extern int  Ffeaturep (), Frequire () , Fprovide ();
  1894. extern int  concat2 (), nconc2 ();
  1895. extern int  assq_no_quit ();
  1896. extern int  Fcopy_alist ();
  1897.  
  1898.  
  1899. extern int  Vpurify_flag;
  1900. extern int  Fcons (), Flist(), Fmake_list ();
  1901. extern int  Fmake_vector (), Fvector (), Fmake_symbol (), Fmake_marker ();
  1902. extern int  Fmake_string (), build_string (), make_string ();
  1903. extern int  make_event_array (), make_uninit_string ();
  1904. extern int  Fpurecopy (), make_pure_string ();
  1905. extern int  pure_cons (), make_pure_vector ();
  1906. extern int  Fgarbage_collect ();
  1907. extern int  Fmake_byte_code ();
  1908.  
  1909.  
  1910. extern int  Vprin1_to_string_buffer;
  1911. extern int  Fprin1 (), Fprin1_to_string (), Fprinc ();
  1912. extern int  Fterpri (), Fprint ();
  1913. extern int  Vstandard_output, Qstandard_output;
  1914. extern int  Qexternal_debugging_output;
  1915. extern void temp_output_buffer_setup (), temp_output_buffer_show ();
  1916. extern int print_level, print_escape_newlines;
  1917. extern int  Qprint_escape_newlines;
  1918.  
  1919.  
  1920. extern int  Qvariable_documentation, Qstandard_input;
  1921. extern int  Vobarray, Vstandard_input;
  1922. extern int  Fread (), Fread_from_string ();
  1923. extern int  Fintern (), Fintern_soft (), Fload ();
  1924. extern int  Fget_file_char (), Fread_char ();
  1925. extern int  read_filtered_event ();
  1926. extern int  Feval_current_buffer (), Feval_region ();
  1927. extern int  intern (), oblookup ();
  1928.  
  1929.  
  1930. extern int  Vcurrent_load_list;
  1931. extern int  Vload_history;
  1932.  
  1933.  
  1934. extern int  Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
  1935. extern int  Vinhibit_quit, Qinhibit_quit, Vquit_flag;
  1936. extern int  Vmocklisp_arguments, Qmocklisp, Qmocklisp_arguments;
  1937. extern int  Vautoload_queue;
  1938. extern int  Vrun_hooks;
  1939. extern int  Fand (), For (), Fif (), Fprogn (), Fprog1 (), Fprog2 ();
  1940. extern int  Fsetq (), Fquote ();
  1941. extern int  Fuser_variable_p (), Finteractive_p ();
  1942. extern int  Fdefun (), Flet (), FletX (), Fwhile ();
  1943. extern int  Fcatch (), Fthrow (), Funwind_protect ();
  1944. extern int  Fcondition_case (), Fsignal ();
  1945. extern int  Ffunction_type (), Fautoload (), Fcommandp ();
  1946. extern int  Feval (), Fapply (), Ffuncall ();
  1947. extern int  Fglobal_set (), Fglobal_value (), Fbacktrace ();
  1948. extern int  apply1 (), call0 (), call1 (), call2 (), call3 ();
  1949. extern int  apply_lambda ();
  1950. extern int  internal_catch ();
  1951. extern int  internal_condition_case ();
  1952. extern int  unbind_to ();
  1953. extern void error ();
  1954. extern int  un_autoload ();
  1955.  
  1956.  
  1957. extern int  Vprefix_arg, Qminus, Vcurrent_prefix_arg;
  1958. extern int  Fgoto_char ();
  1959. extern int  Fpoint_min_marker (), Fpoint_max_marker ();
  1960. extern int  Fpoint_min (), Fpoint_max ();
  1961. extern int  Fpoint (), Fpoint_marker (), Fmark_marker ();
  1962. extern int  Ffollowing_char (), Fprevious_char (), Fchar_after ();
  1963. extern int  Finsert ();
  1964. extern int  Feolp (), Feobp (), Fbolp (), Fbobp ();
  1965. extern int  Fformat (), format1 ();
  1966. extern int  make_buffer_string (), Fbuffer_substring ();
  1967. extern int  Fbuffer_string ();
  1968. extern int  Fstring_equal (), Fstring_lessp (), Fbuffer_substring_lessp ();
  1969. extern int  save_excursion_save (), save_restriction_save ();
  1970. extern int  save_excursion_restore (), save_restriction_restore ();
  1971. extern int  Fchar_to_string ();
  1972.  
  1973.  
  1974. extern int  Vbuffer_alist, Vinhibit_read_only;
  1975. extern int  Fget_buffer (), Fget_buffer_create (), Fset_buffer ();
  1976. extern int  Fbarf_if_buffer_read_only ();
  1977. extern int  Fcurrent_buffer (), Fswitch_to_buffer (), Fpop_to_buffer ();
  1978. extern int  Fother_buffer ();
  1979. extern int  Qoverlayp;
  1980. extern struct buffer *all_buffers;
  1981.  
  1982.  
  1983.  
  1984. extern int  Fmarker_position (), Fmarker_buffer ();
  1985. extern int  Fcopy_marker ();
  1986.  
  1987.  
  1988.  
  1989. extern int  Qfile_error;
  1990. extern int  Ffind_file_name_handler ();
  1991. extern int  Ffile_name_as_directory ();
  1992. extern int  Fexpand_file_name (), Ffile_name_nondirectory ();
  1993. extern int  Fsubstitute_in_file_name ();
  1994. extern int  Ffile_symlink_p ();
  1995. extern int  Fverify_visited_file_modtime ();
  1996. extern int  Ffile_exists_p ();
  1997. extern int  Fdirectory_file_name ();
  1998. extern int  Ffile_name_directory ();
  1999. extern int  expand_and_dir_to_file ();
  2000. extern int  Ffile_accessible_directory_p ();
  2001.  
  2002.  
  2003.  
  2004. extern int  Vfundamental_mode_abbrev_table;
  2005.  
  2006.  
  2007. extern int  Fstring_match ();
  2008. extern int  Fscan_buffer ();
  2009.  
  2010.  
  2011.  
  2012. extern int  last_minibuf_string;
  2013. extern int  read_minibuf (), Fcompleting_read ();
  2014. extern int  Fread_from_minibuffer ();
  2015. extern int  Fread_variable (), Fread_buffer (), Fread_key_sequence ();
  2016. extern int  Fread_minibuffer (), Feval_minibuffer ();
  2017. extern int  Fread_string (), Fread_file_name ();
  2018. extern int  Fread_no_blanks_input ();
  2019.  
  2020.  
  2021.  
  2022. extern int  Vcommand_history;
  2023. extern int  Qcall_interactively;
  2024. extern int  Fcall_interactively ();
  2025. extern int  Fprefix_numeric_value ();
  2026.  
  2027.  
  2028.  
  2029. extern int  Fdowncase (), Fupcase (), Fcapitalize ();
  2030.  
  2031.  
  2032.  
  2033. extern int  Qdisabled;
  2034. extern int  Vhelp_form, Vtop_level;
  2035. extern int  Fdiscard_input (), Frecursive_edit ();
  2036. extern int  Fcommand_execute (), Finput_pending_p ();
  2037. extern int  Qvertical_scroll_bar;
  2038.  
  2039.  
  2040.  
  2041. extern int  Qkeymap;
  2042. extern int  current_global_map;
  2043. extern int  Fkey_description (), Fsingle_key_description ();
  2044. extern int  Fwhere_is_internal ();
  2045. extern int  access_keymap (), store_in_keymap ();
  2046. extern int  get_keyelt (), get_keymap();
  2047.  
  2048.  
  2049. extern int  Fvertical_motion (), Findent_to (), Fcurrent_column ();
  2050.  
  2051.  
  2052. extern int  Qwindowp, Qwindow_live_p;
  2053. extern int  Fget_buffer_window ();
  2054. extern int  Fsave_window_excursion ();
  2055. extern int  Fset_window_configuration (), Fcurrent_window_configuration ();
  2056. extern int  Fcoordinates_in_window_p ();
  2057. extern int  Fwindow_at ();
  2058. extern int window_internal_height (), window_internal_width ();
  2059.  
  2060.  
  2061. extern int  Fframep ();
  2062. extern int  Fselect_frame ();
  2063. extern int  Ffocus_frame ();
  2064. extern int  Funfocus_frame ();
  2065. extern int  Fselected_frame ();
  2066. extern int  Fwindow_frame ();
  2067. extern int  Fframe_root_window ();
  2068. extern int  Fframe_selected_window ();
  2069. extern int  Fframe_list ();
  2070. extern int  Fnext_frame ();
  2071. extern int  Fdelete_frame ();
  2072. extern int  Fread_mouse_position ();
  2073. extern int  Fset_mouse_position ();
  2074. extern int  Fmake_frame_visible ();
  2075. extern int  Fmake_frame_invisible ();
  2076. extern int  Ficonify_frame ();
  2077. extern int  Fdeiconify_frame ();
  2078. extern int  Fframe_visible_p ();
  2079. extern int  Fvisible_frame_list ();
  2080. extern int  Fframe_parameters ();
  2081. extern int  Fmodify_frame_parameters ();
  2082. extern int  Fframe_pixel_size ();
  2083. extern int  Fframe_height ();
  2084. extern int  Fframe_width ();
  2085. extern int  Fset_frame_height ();
  2086. extern int  Fset_frame_width ();
  2087. extern int  Fset_frame_size ();
  2088. extern int  Fset_frame_position ();
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094. extern int  decode_env_path ();
  2095. extern int  Vinvocation_name;
  2096. void shut_down_emacs (   );
  2097.  
  2098. extern int noninteractive;
  2099.  
  2100. extern int inhibit_window_system;
  2101.  
  2102.  
  2103. extern int  Fget_process (), Fget_buffer_process (), Fprocessp ();
  2104. extern int  Fprocess_status (), Fkill_process ();
  2105.  
  2106.  
  2107. extern int  Vexec_path, Vexec_directory, Vdata_directory;
  2108.  
  2109.  
  2110. extern int  Vdoc_file_name;
  2111. extern int  Fsubstitute_command_keys ();
  2112. extern int  Fdocumentation (), Fdocumentation_property ();
  2113.  
  2114.  
  2115. extern int  Qbytecode;
  2116. extern int  Fbyte_code ();
  2117.  
  2118.  
  2119. extern int  Qexecute_kbd_macro;
  2120. extern int  Fexecute_kbd_macro ();
  2121.  
  2122.  
  2123. extern int  Fundo_boundary ();
  2124. extern int  truncate_undo_list ();
  2125.  
  2126.  
  2127.  
  2128. extern int initialized;
  2129.  
  2130. extern int immediate_quit;         
  2131.  
  2132. extern void debugger ();
  2133.  
  2134. extern char *getenv (), *ctime (), *getwd ();
  2135. extern long *xmalloc (), *xrealloc ();
  2136. extern void xfree ();
  2137.  
  2138. extern char *egetenv ();
  2139.  
  2140. # 36 "filelock.c" 2
  2141.  
  2142. # 1 "paths.h" 1
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178. # 37 "filelock.c" 2
  2179.  
  2180. # 1 "buffer.h" 1
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.  
  2216.  
  2217.   
  2218.  
  2219.  
  2220.   
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.   
  2228.  
  2229.  
  2230.   
  2231.  
  2232.  
  2233.   
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.   
  2243.  
  2244.  
  2245.   
  2246.  
  2247.  
  2248.   
  2249.  
  2250.  
  2251.   
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.   
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.   
  2267.  
  2268.  
  2269.   
  2270.  
  2271.  
  2272.   
  2273.  
  2274.  
  2275.   
  2276.  
  2277.  
  2278.   
  2279.  
  2280.  
  2281.   
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314. struct buffer_text
  2315.   {
  2316.     unsigned char *beg;             
  2317.     int begv;             
  2318.     int pt;             
  2319.     int gpt;             
  2320.     int zv;             
  2321.     int z;             
  2322.     int gap_size;         
  2323.     int modiff;             
  2324.  
  2325.  
  2326.  
  2327.   };
  2328.  
  2329. struct buffer
  2330.   {
  2331.      
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.      
  2338.     struct buffer_text text;
  2339.      
  2340.  
  2341.  
  2342.     struct buffer *next;
  2343.      
  2344.  
  2345.     int local_var_flags;
  2346.      
  2347.     int save_modified;
  2348.      
  2349.  
  2350.  
  2351.  
  2352.     int modtime;
  2353.      
  2354.     int auto_save_modified;
  2355.      
  2356.  
  2357.     int last_window_start;
  2358.  
  2359.      
  2360.     INTERVAL intervals; 
  2361.  
  2362.      
  2363.  
  2364.  
  2365.  
  2366.      
  2367.  
  2368.  
  2369.  
  2370.  
  2371.     int  markers;
  2372.  
  2373.  
  2374.      
  2375.  
  2376.  
  2377.      
  2378.     int  name;
  2379.      
  2380.      
  2381.     int  filename;
  2382.      
  2383.     int  directory;
  2384.      
  2385.  
  2386.  
  2387.  
  2388.      
  2389.     int  backed_up;
  2390.      
  2391.     int  save_length;
  2392.      
  2393.     int  auto_save_file_name;
  2394.      
  2395.     int  read_only;
  2396.      
  2397.     int  mark;
  2398.  
  2399.      
  2400.  
  2401.     int  local_var_alist;
  2402.  
  2403.  
  2404.      
  2405.     int  major_mode;
  2406.      
  2407.     int  mode_name;
  2408.      
  2409.     int  mode_line_format;
  2410.  
  2411.      
  2412.     int  keymap;
  2413.      
  2414.     int  abbrev_table;
  2415.      
  2416.     int  syntax_table;
  2417.  
  2418.      
  2419.      
  2420.  
  2421.     int  case_fold_search;
  2422.     int  tab_width;
  2423.     int  fill_column;
  2424.     int  left_margin;
  2425.      
  2426.     int  auto_fill_function;
  2427.  
  2428.      
  2429.     int  downcase_table;
  2430.      
  2431.     int  upcase_table;
  2432.  
  2433.      
  2434.     int  truncate_lines;
  2435.      
  2436.     int  ctl_arrow;
  2437.      
  2438.  
  2439.     int  selective_display;
  2440.  
  2441.      
  2442.     int  selective_display_ellipses;
  2443.  
  2444.      
  2445.     int  minor_modes;
  2446.      
  2447.  
  2448.     int  overwrite_mode;
  2449.      
  2450.     int  abbrev_mode;
  2451.      
  2452.     int  display_table;
  2453.      
  2454.     int  case_canon_table;
  2455.      
  2456.     int  case_eqv_table;
  2457.      
  2458.  
  2459.     int  undo_list;
  2460.      
  2461.     int  mark_active;
  2462.  
  2463.      
  2464.  
  2465.     int  overlays_before;
  2466.  
  2467.      
  2468.  
  2469.     int  overlays_after;
  2470.  
  2471.      
  2472.     int  overlay_center;
  2473. };
  2474.  
  2475.  
  2476.  
  2477. extern struct buffer *current_buffer;
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.  
  2484.  
  2485.  
  2486. extern struct buffer buffer_defaults;
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.  
  2496.  
  2497.  
  2498.  
  2499.  
  2500.  
  2501. extern struct buffer buffer_local_flags;
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507. extern struct buffer buffer_local_symbols;
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516. extern struct buffer buffer_local_types;
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533. extern void reset_buffer ();
  2534.  
  2535. extern int  Fbuffer_name ();
  2536. extern int  Fget_file_buffer ();
  2537.  
  2538.  
  2539. extern int  Vbefore_change_function;
  2540. extern int  Vafter_change_function;
  2541. extern int  Vfirst_change_hook;
  2542. extern int  Qfirst_change_hook;
  2543.  
  2544. extern int  Vdeactivate_mark;
  2545. extern int  Vtransient_mark_mode;
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.  
  2582. # 38 "filelock.c" 2
  2583.  
  2584.  
  2585. extern int errno;
  2586.  
  2587. extern char *egetenv ();
  2588. extern char *strcpy ();
  2589.  
  2590.  
  2591.   
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.   
  2602. char *lock_path;
  2603.  
  2604.  
  2605.  
  2606.  
  2607.  
  2608.  
  2609.  
  2610. char *superlock_path;
  2611.  
  2612.  
  2613.  
  2614.  
  2615.  
  2616.  
  2617.  
  2618.  
  2619.  
  2620.  
  2621.  
  2622. fill_in_lock_short_file_name (lockfile, fn)
  2623.      register char *lockfile;
  2624.      register int  fn;
  2625. {
  2626.   register union
  2627.     {
  2628.       unsigned int  word [2];
  2629.       unsigned char byte [8];
  2630.     } crc;
  2631.   register unsigned char *p, new;
  2632.   
  2633.    
  2634.  
  2635.  
  2636.   crc.word[0] = crc.word[1] = 0;
  2637.  
  2638.   for (p = ((struct Lisp_String *) ((   fn   ) & ((1<<24 ) - 1) )  ) ->data; new = *p++; )
  2639.     {
  2640.       new += crc.byte[7];
  2641.       crc.byte[7] = crc.byte[6];
  2642.       crc.byte[6] = crc.byte[5] + new;
  2643.       crc.byte[5] = crc.byte[4];
  2644.       crc.byte[4] = crc.byte[3];
  2645.       crc.byte[3] = crc.byte[2] + new;
  2646.       crc.byte[2] = crc.byte[1];
  2647.       crc.byte[1] = crc.byte[0];
  2648.       crc.byte[0] = new;
  2649.     }
  2650.   sprintf (lockfile, "%s%.2x%.2x%.2x%.2x%.2x%.2x%.2x", lock_path,
  2651.        crc.byte[0], crc.byte[1], crc.byte[2], crc.byte[3],
  2652.        crc.byte[4], crc.byte[5], crc.byte[6]);
  2653. }
  2654.  
  2655. # 135 "filelock.c"
  2656.  
  2657.  
  2658. static int 
  2659. lock_file_owner_name (lfname)
  2660.      char *lfname;
  2661. {
  2662.   struct stat s;
  2663.   struct passwd *the_pw;
  2664.   extern struct passwd *getpwuid ();
  2665.  
  2666.   if (lstat (lfname, &s) == 0)
  2667.     the_pw = getpwuid (s.st_uid);
  2668.   return (the_pw == 0 ? Qnil : build_string (the_pw->pw_name));
  2669. }
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698. void
  2699. lock_file (fn)
  2700.      register int  fn;
  2701. {
  2702.   register int  attack;
  2703.   register char *lfname;
  2704.  
  2705.   ( lfname  = (char *) alloca (14 + strlen (lock_path) + 1), fill_in_lock_short_file_name ( lfname , (  fn ))) ;
  2706.  
  2707.    
  2708.  
  2709.   {
  2710.     register int  subject_buf = Fget_file_buffer (fn);
  2711.     if (! ((  subject_buf  )  == ( Qnil ) ) 
  2712.     &&  ((  Fverify_visited_file_modtime (subject_buf)  )  == ( Qnil ) ) 
  2713.     && ! ((  Ffile_exists_p (fn)  )  == ( Qnil ) ) )
  2714.       call1 (intern ("ask-user-about-supersession-threat"), fn);
  2715.   }
  2716.  
  2717.    
  2718.   if (lock_if_free (lfname) <= 0)
  2719.      
  2720.     return;
  2721.  
  2722.    
  2723.   attack = call2 (intern ("ask-user-about-lock"), fn,
  2724.           lock_file_owner_name (lfname));
  2725.   if (! ((  attack  )  == ( Qnil ) ) )
  2726.      
  2727.     {
  2728.       lock_superlock (lfname);
  2729.       lock_file_1 (lfname, 1 ) ;
  2730.       unlink (superlock_path);
  2731.       return;
  2732.     }
  2733.    
  2734. }
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741. int
  2742. lock_file_1 (lfname, mode)
  2743.      int mode; char *lfname; 
  2744. {
  2745.   register int fd;
  2746.   char buf[20];
  2747.  
  2748.   if ((fd = open (lfname, mode, 0666)) >= 0)
  2749.     {
  2750.  
  2751.  
  2752.  
  2753.       fchmod (fd, 0666);
  2754.  
  2755.       sprintf (buf, "%d ", getpid ());
  2756.       write (fd, buf, strlen (buf));
  2757.       close (fd);
  2758.       return 1;
  2759.     }
  2760.   else
  2761.     return 0;
  2762. }
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769. int
  2770. lock_if_free (lfname)
  2771.      register char *lfname; 
  2772. {
  2773.   register int clasher;
  2774.  
  2775.   while (lock_file_1 (lfname, 1  |         04000             |         01000            ) == 0)
  2776.     {
  2777.       if (errno !=     17        )
  2778.     return -1;
  2779.       clasher = current_lock_owner (lfname);
  2780.       if (clasher != 0)
  2781.     if (clasher != getpid ())
  2782.       return (clasher);
  2783.     else return (0);
  2784.        
  2785.     }
  2786.   return 0;
  2787. }
  2788.  
  2789.  
  2790.  
  2791.  
  2792.  
  2793. int
  2794. current_lock_owner (lfname)
  2795.      char *lfname;
  2796. {
  2797.   int owner = current_lock_owner_1 (lfname);
  2798.   if (owner == 0 && errno ==     2        )
  2799.     return (0);
  2800.    
  2801.   if (owner != 0 && (kill (owner, 0) >= 0 || errno ==     1        ))
  2802.     return (owner);
  2803.   if (unlink (lfname) < 0)
  2804.     return (-1);
  2805.   return (0);
  2806. }
  2807.  
  2808. int
  2809. current_lock_owner_1 (lfname)
  2810.      char *lfname;
  2811. {
  2812.   register int fd;
  2813.   char buf[20];
  2814.   int tem;
  2815.  
  2816.   fd = open (lfname, 0 , 0666);
  2817.   if (fd < 0)
  2818.     return 0;
  2819.   tem = read (fd, buf, sizeof buf);
  2820.   close (fd);
  2821.   return (tem <= 0 ? 0 : atoi (buf));
  2822. }
  2823.  
  2824.  
  2825. void
  2826. unlock_file (fn)
  2827.      register int  fn;
  2828. {
  2829.   register char *lfname;
  2830.  
  2831.   ( lfname  = (char *) alloca (14 + strlen (lock_path) + 1), fill_in_lock_short_file_name ( lfname , (  fn ))) ;
  2832.  
  2833.   lock_superlock (lfname);
  2834.  
  2835.   if (current_lock_owner_1 (lfname) == getpid ())
  2836.     unlink (lfname);
  2837.  
  2838.   unlink (superlock_path);
  2839. }
  2840.  
  2841. lock_superlock (lfname)
  2842.      char *lfname;
  2843. {
  2844.   register int i, fd;
  2845.  
  2846.   for (i = -20; i < 0 && (fd = open (superlock_path,
  2847.                      1  |         04000             |         01000            , 0666)) < 0;
  2848.        i++)
  2849.     {
  2850.       if (errno !=     17        )
  2851.     return;
  2852.       sleep (1);
  2853.     }
  2854.   if (fd >= 0)
  2855.     {
  2856.  
  2857.  
  2858.  
  2859.       fchmod (fd, 0666);
  2860.  
  2861.       write (fd, lfname, strlen (lfname));
  2862.       close (fd);
  2863.     }
  2864. }
  2865.  
  2866. void
  2867. unlock_all_files ()
  2868. {
  2869.   register int  tail;
  2870.   register struct buffer *b;
  2871.  
  2872.   for (tail = Vbuffer_alist; ((enum Lisp_Type) ((( tail ) >> 24 ) & ((1<<7 ) - 1) ))  == Lisp_Cons;
  2873.        tail = ((struct Lisp_Cons *) ((   tail   ) & ((1<<24 ) - 1) )  ) ->cdr)
  2874.     {
  2875.       b = ((struct buffer *) ((   ((struct Lisp_Cons *) ((   ((struct Lisp_Cons *) ((   tail   ) & ((1<<24 ) - 1) )  ) ->car   ) & ((1<<24 ) - 1) )  ) ->cdr   ) & ((1<<24 ) - 1) )  ) ;
  2876.       if (((enum Lisp_Type) (( b->filename ) >> 24 ))  == Lisp_String &&
  2877.       b->save_modified < (( b )->text.modiff) )
  2878.     unlock_file (b->filename);
  2879.     }
  2880. }
  2881.  
  2882.  
  2883. int    Flock_buffer  (); struct Lisp_Subr   Slock_buffer  = {  Flock_buffer ,  
  2884.   0 ,   1 ,  "lock-buffer" ,   0 , 0}; int    Flock_buffer  
  2885.  
  2886.  
  2887.  
  2888.   (fn)
  2889.      int  fn;
  2890. {
  2891.   if ( ((  fn  )  == ( Qnil ) ) )
  2892.     fn = current_buffer->filename;
  2893.   else
  2894.     do { if (((enum Lisp_Type) (( ( fn ) ) >> 24 ))  != Lisp_String)  fn  = wrong_type_argument (Qstringp, ( fn )); } while (0) ;
  2895.   if (current_buffer->save_modified < (current_buffer->text.modiff) 
  2896.       && ! ((  fn  )  == ( Qnil ) ) )
  2897.     lock_file (fn);
  2898.   return Qnil;    
  2899. }
  2900.  
  2901. int    Funlock_buffer  (); struct Lisp_Subr   Sunlock_buffer  = {  Funlock_buffer ,  
  2902.   0 ,   0 ,  "unlock-buffer" ,   0 , 0}; int    Funlock_buffer  
  2903.  
  2904.  
  2905.   ()
  2906. {
  2907.   if (current_buffer->save_modified < (current_buffer->text.modiff)  &&
  2908.       ((enum Lisp_Type) (( current_buffer->filename ) >> 24 ))  == Lisp_String)
  2909.     unlock_file (current_buffer->filename);
  2910.   return Qnil;
  2911. }
  2912.  
  2913.  
  2914.  
  2915.  
  2916. unlock_buffer (buffer)
  2917.      struct buffer *buffer;
  2918. {
  2919.   if (buffer->save_modified < (( buffer )->text.modiff)  &&
  2920.       ((enum Lisp_Type) (( buffer->filename ) >> 24 ))  == Lisp_String)
  2921.     unlock_file (buffer->filename);
  2922. }
  2923.  
  2924. int    Ffile_locked_p  (); struct Lisp_Subr   Sfile_locked_p  = {  Ffile_locked_p ,   0 ,   1 ,  "file-locked-p" ,   0 , 0}; int    Ffile_locked_p  
  2925.  
  2926.  
  2927.   (fn)
  2928.   int  fn;
  2929. {
  2930.   register char *lfname;
  2931.   int owner;
  2932.  
  2933.   fn = Fexpand_file_name (fn, Qnil);
  2934.  
  2935.   ( lfname  = (char *) alloca (14 + strlen (lock_path) + 1), fill_in_lock_short_file_name ( lfname , (  fn ))) ;
  2936.  
  2937.   owner = current_lock_owner (lfname);
  2938.   if (owner <= 0)
  2939.     return (Qnil);
  2940.   else if (owner == getpid ())
  2941.     return (Qt);
  2942.   
  2943.   return (lock_file_owner_name (lfname));
  2944. }
  2945.  
  2946.  
  2947.  
  2948.  
  2949. init_filelock ()
  2950. {
  2951.   lock_path = egetenv ("EMACSLOCKDIR");
  2952.   if (! lock_path)
  2953.     lock_path = "/home/gd/gnu/emacs/19.0/lock/" ;
  2954.  
  2955.    
  2956.   if (lock_path[strlen (lock_path) - 1] != '/')
  2957.     {
  2958.       lock_path = strcpy ((char *) xmalloc (strlen (lock_path) + 2),
  2959.               lock_path);
  2960.       strcat (lock_path, "/");
  2961.     }
  2962.  
  2963.   superlock_path = (char *) xmalloc ((strlen (lock_path)
  2964.                       + sizeof ("!!!SuperLock!!!" )));
  2965.   strcpy (superlock_path, lock_path);
  2966.   strcat (superlock_path, "!!!SuperLock!!!" );
  2967. }
  2968.  
  2969. syms_of_filelock ()
  2970. {
  2971.   defsubr (&Sunlock_buffer);
  2972.   defsubr (&Slock_buffer);
  2973.   defsubr (&Sfile_locked_p);
  2974. }
  2975.  
  2976.  
  2977.